package com.sunfield.windpower.decoration;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.sunfield.windpower.adapter.QuickEnterAdapter;

/**
 * Created by wxl on 2017/2/8.
 */

public class QuickEnterSpaceDecoration extends SpaceDecoration{

    public QuickEnterSpaceDecoration() {
        super(30, TYPE_END);
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        QuickEnterAdapter adapter = null;
        try {
            adapter = (QuickEnterAdapter) parent.getAdapter();
        } catch (Exception e) {
        }
        if(adapter == null){
            return;
        }
        super.getItemOffsets(outRect, view, parent, state);
        if(parent.getChildLayoutPosition(view) == adapter.getType1Count() - 1){
            outRect.bottom = 0;
        }
    }
}
